﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

using System.Text;

namespace SmartHYU_TestVersion.Life
{
    public partial class DepartmentInfo : PhoneApplicationPage
    {
        public DepartmentInfo()
        {
            InitializeComponent();

            DepartInformationManager hyuDepartments = new DepartInformationManager();
            departmentNamesListBox.ItemsSource = hyuDepartments.DepartmentCategories;
        }

        private void departmentNamesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // make uri string
            StringBuilder uriToNavigate = new StringBuilder("/Life/DepartmentInfoDetail.xaml");
            uriToNavigate.Append("?index=");
            uriToNavigate.Append(departmentNamesListBox.SelectedIndex.ToString());
            
            NavigationService.Navigate(new Uri(uriToNavigate.ToString(), UriKind.Relative));

            departmentNamesListBox.SelectedIndex = -1;
        }
    }
}